package cn.school.filter;///*
//package cn.school.filter;
//
//import javax.servlet.*;
//import javax.servlet.annotation.WebFilter;
//import javax.servlet.http.HttpServletRequest;
//import java.io.IOException;
////组织规则
////web.xml中，看前后
////注解，默认是按照名字的顺序
//@WebFilter(filterName = "CCC",value = "/*")
//public class RoleFilter implements Filter {
//    public void destroy() {
//    }
//
//    public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws ServletException, IOException {
//        HttpServletRequest request=(HttpServletRequest)req;
//        //>>>loginServlet
//        String path=request.getServletPath();
//        System.out.println("进入了RoleFilter,当前正在验证："+path);
//        if(path.endsWith(".do")||path.endsWith("/login.jsp")||path.endsWith("/loginServlet")||
//        path.endsWith(".css")||path.endsWith(".js")){
//            chain.doFilter(req, resp);//放他走
//            return;
//        }
//
//        if (request.getSession().getAttribute("USER_LOGIN")==null){
//            request.setAttribute("msg","未登录");
//            request.getRequestDispatcher("/login.jsp").forward(request,resp);
//            return;
//        }
//        chain.doFilter(req, resp);//放他走
//        System.out.println("离开了：RoleFilter");
//    }
//
//    public void init(FilterConfig config) throws ServletException {
//
//    }
//
//}
//*/
